package com.marry.api;

import com.marry.entity.Invitation;
import com.marry.model.Result;
import com.marry.repository.InvitationRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 接口
 */
@RestController
@RequestMapping("/api/marry")
public class MarryApi {

    @Autowired
    private InvitationRepository invitationRepository;

    /**
     * 获取
     */
    @RequestMapping("/get")
    public Result get() {
        Invitation invitation = null;
        List<Invitation> list = invitationRepository.findAll();
        if(list!=null&&list.size()!=0){
            invitation = list.get(0);
        }
        return Result.ok(invitation);
    }
}
